<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create New Person </title>
<script language="javascript" type="text/javascript"
	src="js/datepicker.js"></script>
<link rel="stylesheet" href="css/datepicker.css" />
<link rel="stylesheet" href="css/common.css" />
<script language="javascript" type="text/javascript" src="js/common.js"></script>
<script language="javascript" type="text/javascript"
	src="js/jquery-1.6.1.min.js"></script>

<script language="javascript" type="text/javascript">
	var requiredInputs = [['first_name','first_name_required'],['last_name','last_name_required'],['mobile','mobile_required'],['company_phone','company_phone_required'],['home_phone','home_phone_required'],['company_email','company_email_required'],['personal_email','personal_email_required'],['address','address_required'],['birthdate','birthdate_date_required', 'birthdate','birthdate_time_required'],['identity_no','identity_no_required'],['description','description_required'],['status','status_required'],['notification','notification_required']];
	var intInputs = [['status','status_invalid'],['notification','notification_invalid']];
	var doubleInputs = [];
	var dateInputs = [['birthdate','birthdate_date_invalid']];
	var timeInputs = [['birthdate','birthdate_time_invalid']];

	function checkInputs() {
		var valid = true;

		if (checkRequiredInputs(requiredInputs) == false) {
			valid = false;
		}
		if (checkIntInputs(intInputs) == false) {
			valid = false;
		}
		if (checkDoubleInputs(doubleInputs) == false) {
			valid = false;
		}
		if (checkDateInputs(dateInputs) == false) {
			valid = false;
		}
		if (checkTimeInputs(timeInputs) == false) {
			valid = false;
		}

		// SPECIFIC VALIDATE CODE HERE		

		return valid;
	}
</script>
</head>
<body>
	<form action="personServlet?mode=insert" method="post"
        onSubmit="return checkInputs()"
        onreset="return confirm('Do you really want to reset the form?')">
		<table class="tblInput" border="1">
			<tr class="inputHeader">
				<td colspan="3" class="inputHeader">Create New Person </td>
			</tr>
			<tr class="trField">
				<td class="tdFieldName">Is Employee </td><td class="tdFieldInput">
					<table class="tblBool">
						<tr class="trBoolSet">
							<td colspan="2" class="tdBoolSet"><input type="checkbox"
								id="ckb_is_employee" name="ckb_is_employee"
								onchange="toggleControls(['is_employee_true', 'is_employee_false'])" />Not
								set</td>
						</tr>
						<tr class="trBool">
							<td class="tdBool"><input type="radio"
								id="is_employee_true" name="is_employee" value="1"
								checked="checked" />Yes</td>
							<td class="tdBool"><input type="radio"
								id="is_employee_false" name="is_employee" value="0" />No</td>
						</tr>
					</table></td>
				<td class="tdErrMsg"></td></tr>
			<tr class="trField">
				<td class="tdFieldName">First Name </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="first_name" name="first_name" maxlength="25" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">First Name  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">First Name  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Last Name </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="last_name" name="last_name" maxlength="25" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Last Name  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Last Name  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Mobile </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="mobile" name="mobile" maxlength="20" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Mobile  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Mobile  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Company Phone </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="company_phone" name="company_phone" maxlength="25" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Company Phone  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Company Phone  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Home Phone </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="home_phone" name="home_phone" maxlength="25" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Home Phone  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Home Phone  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Company Email </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="company_email" name="company_email" maxlength="255" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Company Email  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Company Email  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Personal Email </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="personal_email" name="personal_email" maxlength="255" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Personal Email  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Personal Email  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Address </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="address" name="address" maxlength="255" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Address  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Address  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Birthdate </td>				<td class="tdFieldInput">
					<table class="tblDateTime">
						<tr class="trDateTime">
							<td class="tdDate">
								<input type="text" maxlength="10" class="inputDate" id="birthdate_date" name="birthdate_date" /> 
								<input type="button" class="btnCalendar" value="..."
									onclick="javascript:displayDatePicker('birthdate_date', this, dateFormat);" />
							</td>
							<td class="tdTime">
								<input type="text" maxlength="5" class="inputTime" id="birthdate_time" name="birthdate_time" />
							</td>
						</tr>
					</table></td>
				<td class="tdErrMsg">
					<div class="divErr">
						<span id="birthdate_date_required" class="errMsg"
							style="display: none;">Birthdate 's date is required</span>
					</div>
					<div class="divErr">
						<span id="birthdate_time_required" class="errMsg"
							style="display: none;">Birthdate 's time is required</span>
					</div>
					<div class="divErr">
						<span id="birthdate_date_invalid" class="errMsg"
							style="display: none;">Birthdate 's date is invalid</span>
					</div>
					<div class="divErr">
						<span id="birthdate_time_invalid" class="errMsg"
							style="display: none;">Birthdate 's time is invalid</span>
					</div>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Identity No </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="identity_no" name="identity_no" maxlength="25" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Identity No  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Identity No  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Gender </td><td class="tdFieldInput">
					<table class="tblBool">
						<tr class="trBoolSet">
							<td colspan="2" class="tdBoolSet"><input type="checkbox"
								id="ckb_gender" name="ckb_gender"
								onchange="toggleControls(['gender_true', 'gender_false'])" />Not
								set</td>
						</tr>
						<tr class="trBool">
							<td class="tdBool"><input type="radio"
								id="gender_true" name="gender" value="1"
								checked="checked" />Yes</td>
							<td class="tdBool"><input type="radio"
								id="gender_false" name="gender" value="0" />No</td>
						</tr>
					</table></td>
				<td class="tdErrMsg"></td></tr>
			<tr class="trField">
				<td class="tdFieldName">Description </td>				    <td class="tdFieldInput">
					<textarea id="description" name="description" rows="5" class="inputTextarea"></textarea>
				</td>
				<td class="tdErrMsg">
					<span id="description_required" class="errMsg" style="display: none;">Description  is required</span>
					<span id="description_invalid" class="errMsg" style="display: none;">Description  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Status </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="status" name="status" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="status_required" class="errMsg" style="display: none;">Status  is required</span> 
					<span id="status_invalid" class="errMsg" style="display: none;">Status  is invalid</span>
                </td></tr>
			<tr class="trField">
				<td class="tdFieldName">Is Draft </td><td class="tdFieldInput">
					<table class="tblBool">
						<tr class="trBoolSet">
							<td colspan="2" class="tdBoolSet"><input type="checkbox"
								id="ckb_is_draft" name="ckb_is_draft"
								onchange="toggleControls(['is_draft_true', 'is_draft_false'])" />Not
								set</td>
						</tr>
						<tr class="trBool">
							<td class="tdBool"><input type="radio"
								id="is_draft_true" name="is_draft" value="1"
								checked="checked" />Yes</td>
							<td class="tdBool"><input type="radio"
								id="is_draft_false" name="is_draft" value="0" />No</td>
						</tr>
					</table></td>
				<td class="tdErrMsg"></td></tr>
			<tr class="trField">
				<td class="tdFieldName">Notification </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="notification" name="notification" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="notification_required" class="errMsg" style="display: none;">Notification  is required</span> 
					<span id="notification_invalid" class="errMsg" style="display: none;">Notification  is invalid</span>
                </td></tr>
			
			<tr class="trInputBottom">
				<td class="trInputBottom" colspan="3">
					<table class="tblSubmit" align="center">
						<tr class="trSubmit">
							<td class="tdSubmit"><input type="submit" value="Submit" />
							</td>
							<td class="tdReset"><input type="reset" value="Reset" /></td>
						</tr>
					</table></td>
			</tr>
		</table>
	</form>
</body>
</html>